<div style="margin:50px 50px 50px 50px">
    <form class="layui-form layui-form-pane" lay-filter="example">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label"><i class="ui blue book icon"></i>员工姓名</label>
                <div class="layui-input-block">
                    <input type="text" name="staffName" required lay-verify="required" autocomplete="off"
                           placeholder="请输入员工名" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label"><i class="ui blue user outline icon"></i>员工类型</label>
                <div class="layui-input-inline">
                    <select name="staffType" lay-verify="required">
                        <option value="">请选择类型</option>
                        <option value="0">普通员工(学徒)</option>
                        <option value="1">普通员工(熟手)</option>
                        <option value="2">前台</option>
                        <option value="3">主管</option>
                        <option value="4">管理员(老板)</option>
                    </select>
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label"><i class="ui violet user outline icon"></i>初始密码</label>
                <div class="layui-input-block">
                    <input type="text" name="staffPassword" required lay-verify="required" autocomplete="off"
                           placeholder="请输入密码" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label"><i class="ui blue font icon"></i>选择团队</label>
                <div class="layui-input-inline">
                    <select name="staffTeam" lay-verify="required">
                        <option value="">请选择团队</option>
                        <option value="1">建模</option>
                        <option value="2">渲染</option>
                        <option value="3">后期</option>
                        <option value="4">管理</option>
                        <option value="5">其他</option>
                    </select>
                </div>
            </div>
        </div>


        <div class="layui-form-item">

            <div class="layui-input-block">
                <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-danger">重置</button>
            </div>
        </div>
    </form>
</div>
<script>
    layui.use(['form', 'layedit', 'laydate'], function () {
        const form = layui.form
            , layer = layui.layer;
        form.render('select');
        //监听提交
        form.on('submit(demo1)', function (data) {
            $.ajax({
                url: "/staff/add",
                method: "post",
                contentType: "application/json;charset=utf-8",
                data: JSON.stringify(data.field),
                dataType: "json",
                success: function () {
                    layer.alert('添加成功', {
                        skin: 'layui-layer-lan' //样式类名
                        , closeBtn: 0
                    });
                }
            })
            return false;
        });
    });
</script>